package com.xiaohei.article.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaohei.article.dao.ArticleMapper;
import com.xiaohei.article.service.ArticleService;
import com.xiaohei.pojo.Article;
import com.xiaohei.pojo.QueryParams;
import entity.PageResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: ZhangYongLiang
 * @Date: 2020/12/15 23:34
 **/
@Service
public class ArticleServiceImpl implements ArticleService {

    @Resource
    private ArticleMapper articleMapper;

    @Override
    public PageResult queryTotal(QueryParams params, int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<Article> articleList = articleMapper.queryTotal(params);
        PageInfo<Article> pageInfo = new PageInfo<>(articleList);
        return new PageResult(pageInfo.getTotal(),pageNo,pageSize,articleList);
    }

    @Override
    public void add(Article article) {
        //新增
    }
}
